﻿namespace wToggle.Platform.Interfaces
{
    using System.Collections.Generic;
    using System.Threading.Tasks;

    using wToggle.Platform.Data;

    public interface ICacheProvider
    {
        Task Initialize();

        TEntity LoadEntity<TEntity>(ulong key) where TEntity : class, IEntity;

        ICollection<TEntity> LoadEntities<TEntity>() where TEntity : class, IEntity;

        Task StoreEntity<TEntity>(TEntity entity, bool withLock) where TEntity : class,  IEntity;

        Task StoreEntities<TEntity>(IEnumerable<TEntity> entities) where TEntity : class, IEntity;

        Task Save();

        bool HasPendingWrites(bool withLock = true);

        Task Purge();

        Task StoreEntryWrite<TEntity>(TEntity entry, WriteType type, bool withLock) where TEntity : class, IEntity;

        Task<bool> FlushWrites();

        Task RemoveEntity<T>(ulong id, bool withLock) where T : class, IEntity;
    }
}
